package karma.main;

import net.minecraft.src.forge.*;
import net.minecraft.client.Minecraft;
import net.minecraft.src.*;

public class ItemHellBody extends ItemArmor
{
    public static boolean ELBodyWorn;
    public static int timer = 0;
    
    public ItemHellBody(int i, EnumArmorMaterial enumarmormaterial, int j, int k)
    {
        super(i, enumarmormaterial, j, k);
    }

    /**
     * Return an item rarity from EnumRarity
     */
    public EnumRarity getRarity(ItemStack itemstack)
    {
        return mod_KarmaCraft.ENCHANTED;
    }
    
    public static void checkIfWorn(Minecraft minecraft)
    {
        if (minecraft.thePlayer.inventory.armorInventory[2] != null && minecraft.thePlayer.inventory.armorInventory[2].getItem() == mod_KarmaCraft.HellBody)
        {
            doSpecial(minecraft);
        }
    }
    
    public static void doSpecial(Minecraft mc)
    {
    	EntityPlayer player = mc.thePlayer;
    	int half = player.getMaxHealth() / 2;
    	if(player.getHealth() <= half && timer == 0)
    	{
    		player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 100, 1));
    		player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 100, 1));
    		timer = 100;
    		player.inventory.armorInventory[2].damageItem(2, player);
    	}
    	if (timer > 0)
    	{
    		timer --;
    	}
    }
}
